package com.leon.learnenginespace.drools.utils.operation.impl;


import com.leon.learnenginespace.drools.utils.MathUtils;
import com.leon.learnenginespace.drools.utils.operation.IOperationBase;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 长度等于
 * @author DJ032474
 */
@Component
public class LengthEqualsOperation implements IOperationBase {
    @Autowired
    private EqualsOperation equalsOperation;
    /**
     * v1.length==v2、v1.length==v2.length、v1==v2.length
     * @param v 值
     * @return
     */
    @Override
    public Boolean operation(String dataType,Object ...v) {
        // v1.length==v2
        Object v1 = v[0];
        Object v2 = v[1];
       int v1Size = MathUtils.getLength(v1);
//       int v2Size = MathUtils.getLength(v2);
       return equalsOperation.operation("int", v1Size, v2);
    }
}
